<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ page import ="java.util.List,home.domain.Home,java.sql.*" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Home</title>
<link rel="stylesheet" type="text/css" href="css/demo.css" />
<link rel="stylesheet" type="text/css" href="css/menu_sideslide.css" />
<style type="text/css">
body{
	background-image:url(images/bg.jpg);
	background-attachment:fixed;
	background-repeat:no-repeat;
	background-size:cover;
	-moz-background-size:cover;
	-webkit-background-size:cover;
	}
.tab{
	width:100%;
	text-align:center;
	background-color:#CFC;
	margin:0 auto;
	}

.trow{
      background-color:#336666;
      height:35px;
      font-size:20px; 
}
.srow{
      background-color:#00FF99;
      height:35px;
      font-size:20px;
}
</style>
<script type="text/javascript">

</script>
</head>
<body>
<div class="container">

<div class="menu-wrap">
  <nav class="menu">
    <div class="icon-list">
	 <a href="profile.jsp"><i class=""></i><span>个人资料</span></a>
	 <a href="query.jsp"><span>查询</span></a>
	 <a href="add.jsp"><span>添加</span></a>
	 <a href="delete.do"><span>去重复</span></a>
	 <a href="login.jsp"><span>更改用户</span></a>
	 <a href="login,jsp"><span>退出</span></a>
	</div>
  </nav>
  <button class="close-button" id="close-button">Close Menu</button>
</div>
   <button class="menu-button" id="open-button">Open Menu</button>
   <div class="content-wrap">
    <div class="content">
    
	  <header class="codrops-header">
       <h1><span class="icon-list"></span>XXX通讯录系统<span>Enjoy It！</span></h1>
        <hr style="height:1px;border:none;border-top:1px solid #24272C;">
       
       <%
		//驱动程序名 
		String driverName = "com.mysql.jdbc.Driver";
		//数据库用户名 
		String userName = "root";
		//密码 
		String userPasswd = "39120150813";
		//数据库名 
		String dbName = "users";
		//表名 
		String tableName = "book";
		//联结字符串 
		String url = "jdbc:mysql://localhost:3306/" + dbName + "?user="
				+ userName + "&password=" + userPasswd;
		Class.forName("com.mysql.jdbc.Driver").newInstance();
		Connection connection = DriverManager.getConnection(url);
		Statement statement = connection.createStatement();
		String sql = "SELECT * FROM " + tableName;
		ResultSet rs = statement.executeQuery(sql);
	%>
	<table class="tab"align="center">
	
		<tr class="trow" >
			<th>
				<%
					out.print("姓名");
				%>
			</th>
			<th>
				<%
					out.print("地址");
				%>
			</th>
			<th >
				<%
					out.print("电话");
				%>
				</th>
			</tr>
       
		<%
			while (rs.next()) {
		%>
		<tr class="srow">
			<td>
				<%
					out.print(rs.getString(2));
				%>
			</td>
			<td>
				<%
					out.print(rs.getString(5));
				%>
			</td>
			<td>
				<%
					out.print(rs.getString(3));
				%> 
			</td>
			
		</tr>
		<%
			}
		%>
		
	</table>
	<%
		rs.close();
		statement.close();
		connection.close();
	%>  

       </header><!-- Related demos -->
      </div>
	</div><!-- /content-wrap -->
</div><!-- /container -->
<script src="js/classie.js"></script>
<script src="js/main.js"></script>
</body>
</html>